package com.unit_7.util;
import unit_4.Circle;
import java.util.Scanner;
public class Cylinder extends Circle{
    private double height;
    public Cylinder() {}
    public Cylinder(double radius, double height){
        this.height = height;
        this.radius = radius;
    }
    @Override
    public double getArea(){
        return getPerimeter() * height;
    }
    public double getVolume(){
        return super.getArea() * height;
    }

    public static void main(String[] args){
        double radius, height;
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入圆柱的底面半径：");
        radius = sc.nextDouble();
        System.out.print("请输入圆柱的高：");
        height = sc.nextDouble();
        Cylinder cylinder = new Cylinder(radius, height);
        System.out.print("圆柱体的表面积是：" + cylinder.getArea());
        System.out.print(" 圆柱体的体积是：" + cylinder.getVolume());
    }

}
